package com.homework;

import java.util.LinkedList;

public class MyStack {
    private LinkedList ls=new LinkedList();

    public void push(Object obj){
        ls.addFirst(obj);
    }
    public Object pop(){
        Object obj = ls.getFirst();
        ls.removeFirst();
        return obj;
    }
    public int size(){
        return ls.size();
    }
    public static void main(String[] args) {
        MyStack ms=new MyStack();
        ms.push("a");
        ms.push("b");
        ms.push("c");
        ms.push("d");
        while(ms.size()!=0){
            System.out.println(ms.pop());
        }
    }
}

